/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package jpa.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author jordan
 */
@Entity
@Table(name = "coletor_material")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ColetorMaterial.findAll", query = "SELECT c FROM ColetorMaterial c"),
    @NamedQuery(name = "ColetorMaterial.findById", query = "SELECT c FROM ColetorMaterial c WHERE c.id = :id")})
public class ColetorMaterial implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @JoinColumn(name = "id_material", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Material idMaterial;
    @JoinColumn(name = "id_coletor", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Coletor idColetor;

    public ColetorMaterial() {
    }

    public ColetorMaterial(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Material getIdMaterial() {
        return idMaterial;
    }

    public void setIdMaterial(Material idMaterial) {
        this.idMaterial = idMaterial;
    }

    public Coletor getIdColetor() {
        return idColetor;
    }

    public void setIdColetor(Coletor idColetor) {
        this.idColetor = idColetor;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ColetorMaterial)) {
            return false;
        }
        ColetorMaterial other = (ColetorMaterial) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jpa.entities.ColetorMaterial[ id=" + id + " ]";
    }
    
}
